package com.research.performace.entities;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name ="tblpaymentrequests")
public class PaymentRequest {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "ID")
	private Long id;
	
	@Column(name = "PaymentDate")
	private Date paymentDate = new Date();
	
	@Column(name = "Notes")
	private String notes;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CustomerID")
	private Customer customer;
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "paymentRequest")
	private List<Invoice> invoices;

	/**
	 * Constructor
	 */
	public PaymentRequest() { }

	/**
	 * Constructor
	 * @param paymentDate
	 * @param notes
	 */
	public PaymentRequest(Date paymentDate, String notes) {
		this.paymentDate = paymentDate;
		this.notes = notes;
	}

	public Date getPaymentDate() {
		return paymentDate;
	}

	public void setPaymentDate(Date paymentDate) {
		this.paymentDate = paymentDate;
	}

	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}

}
